package net.synck.gcontact.test;

import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.layout.GridData;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Combo;

public class CopyOfContactEditorComposite2 extends Composite {

	private FormToolkit formToolkit = null;   //  @jve:decl-index=0:visual-constraint=""
	private Composite compositeMain = null;
	private Form formMain = null;
	private Section sectionEmails = null;
	private Composite compositeEmails = null;
	private Composite compositeEmailList = null;
	private Tree tree = null;
	private Button buttonAddEmail = null;
	private Button buttonRemoveEmail = null;
	private Composite compositeEmailDetails = null;
	private Label labelAdressEmail = null;
	private Label labelEmailType = null;
	private Label labelEmailPrimary = null;
	private Text textEmailAdress = null;
	private Combo comboEmailType = null;
	private Button checkBoxEmailPrimary = null;
	private ExpandableComposite expandableCompositeMainDetails = null;
	private Text textContactTitle = null;
	public CopyOfContactEditorComposite2(Composite parent, int style) {
		super(parent, style);
		initialize();
	}

	private void initialize() {
		createCompositeMain();
		setSize(new Point(568, 388));
		setLayout(new GridLayout());
	}

	/**
	 * This method initializes formToolkit	
	 * 	
	 * @return org.eclipse.ui.forms.widgets.FormToolkit	
	 */
	private FormToolkit getFormToolkit() {
		if (formToolkit == null) {
			formToolkit = new FormToolkit(Display.getCurrent());
		}
		return formToolkit;
	}

	/**
	 * This method initializes compositeMain	
	 *
	 */
	private void createCompositeMain() {
		GridData gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;
		gridData.grabExcessHorizontalSpace = true;
		gridData.grabExcessVerticalSpace = true;
		gridData.verticalAlignment = GridData.FILL;
		compositeMain = getFormToolkit().createComposite(this);
		compositeMain.setLayout(new GridLayout());
		createFormMain();
		compositeMain.setLayoutData(gridData);
	}

	/**
	 * This method initializes formMain	
	 *
	 */
	private void createFormMain() {
		GridData gridData1 = new GridData();
		gridData1.grabExcessHorizontalSpace = true;
		gridData1.horizontalAlignment = GridData.FILL;
		gridData1.verticalAlignment = GridData.FILL;
		gridData1.grabExcessVerticalSpace = true;
		formMain = getFormToolkit().createForm(compositeMain);
		formMain.setText("Main");
		formMain.setLayoutData(gridData1);
		createExpandableCompositeMainDetails();
		createSectionEmails();
		formMain.getBody().setLayout(new GridLayout());
	}

	/**
	 * This method initializes sectionEmails	
	 *
	 */
	private void createSectionEmails() {
		GridData gridData2 = new GridData();
		gridData2.horizontalAlignment = GridData.FILL;
		gridData2.grabExcessHorizontalSpace = true;
		gridData2.verticalAlignment = GridData.CENTER;
		sectionEmails = getFormToolkit().createSection(
				formMain.getBody(),
				ExpandableComposite.TWISTIE | Section.DESCRIPTION
						| ExpandableComposite.TITLE_BAR);
		sectionEmails.setExpanded(true);
		sectionEmails.setDescription("Email adresses");
		createCompositeEmails();
		sectionEmails.setText("Emails");
		sectionEmails.setLayoutData(gridData2);
		sectionEmails.setClient(compositeEmails);
	}

	/**
	 * This method initializes compositeEmails	
	 *
	 */
	private void createCompositeEmails() {
		GridData gridData6 = new GridData();
		gridData6.horizontalAlignment = GridData.BEGINNING;
		gridData6.widthHint = 3;
		gridData6.verticalAlignment = GridData.FILL;
		GridLayout gridLayout1 = new GridLayout();
		gridLayout1.numColumns = 3;
		compositeEmails = getFormToolkit().createComposite(sectionEmails);
		compositeEmails.setLayout(gridLayout1);
		createCompositeEmailList();
		Composite separator = getFormToolkit().createCompositeSeparator(compositeEmails);
		separator.setLayoutData(gridData6);
		createCompositeEmailDetails();
	}

	/**
	 * This method initializes compositeEmailList	
	 *
	 */
	private void createCompositeEmailList() {
		GridData gridData5 = new GridData();
		gridData5.horizontalAlignment = GridData.FILL;
		gridData5.verticalAlignment = GridData.BEGINNING;
		GridData gridData4 = new GridData();
		gridData4.horizontalAlignment = GridData.FILL;
		gridData4.verticalAlignment = GridData.BEGINNING;
		GridData gridData3 = new GridData();
		gridData3.verticalSpan = 2;
		gridData3.widthHint = 150;
		GridLayout gridLayout2 = new GridLayout();
		gridLayout2.numColumns = 2;
		compositeEmailList = getFormToolkit().createComposite(compositeEmails);
		compositeEmailList.setLayout(gridLayout2);
		tree = getFormToolkit().createTree(compositeEmailList, SWT.BORDER);
		tree.setLayoutData(gridData3);
		buttonAddEmail = getFormToolkit().createButton(compositeEmailList, "Add", SWT.PUSH);
		buttonAddEmail.setLayoutData(gridData4);
		buttonRemoveEmail = getFormToolkit().createButton(compositeEmailList, "Remove", SWT.PUSH);
		buttonRemoveEmail.setLayoutData(gridData5);
	}

	/**
	 * This method initializes compositeEmailDetails	
	 *
	 */
	private void createCompositeEmailDetails() {
		GridData gridData8 = new GridData();
		gridData8.horizontalAlignment = GridData.FILL;
		gridData8.grabExcessHorizontalSpace = true;
		gridData8.verticalAlignment = GridData.CENTER;
		GridLayout gridLayout3 = new GridLayout();
		gridLayout3.numColumns = 2;
		GridData gridData7 = new GridData();
		gridData7.horizontalAlignment = GridData.FILL;
		gridData7.grabExcessHorizontalSpace = true;
		gridData7.verticalAlignment = GridData.FILL;
		compositeEmailDetails = getFormToolkit().createComposite(compositeEmails);
		compositeEmailDetails.setLayoutData(gridData7);
		compositeEmailDetails.setLayout(gridLayout3);
		labelAdressEmail = getFormToolkit().createLabel(compositeEmailDetails, "Adress:");
		textEmailAdress = getFormToolkit().createText(compositeEmailDetails, null, SWT.SINGLE | SWT.BORDER);
		textEmailAdress.setLayoutData(gridData8);
		labelEmailType = getFormToolkit().createLabel(compositeEmailDetails, "Type:");
		createComboEmailType();
		labelEmailPrimary = getFormToolkit().createLabel(compositeEmailDetails, "Primary:");
		checkBoxEmailPrimary = getFormToolkit().createButton(compositeEmailDetails, null, SWT.CHECK);
	}
	/**
	 * This method initializes expandableCompositeMainDetails	
	 *
	 */
	private void createExpandableCompositeMainDetails() {
		GridData gridData10 = new GridData();
		gridData10.horizontalAlignment = GridData.FILL;
		gridData10.grabExcessHorizontalSpace = true;
		gridData10.verticalAlignment = GridData.CENTER;
		expandableCompositeMainDetails = getFormToolkit().createExpandableComposite(formMain.getBody(), ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
		expandableCompositeMainDetails.setExpanded(true);
		expandableCompositeMainDetails.setLayoutData(gridData10);
		expandableCompositeMainDetails.setText("General");
		textContactTitle = getFormToolkit().createText(expandableCompositeMainDetails, null, SWT.SINGLE);
		expandableCompositeMainDetails.setClient(textContactTitle);
	}
	/**
	 * This method initializes comboEmailType	
	 *
	 */
	private void createComboEmailType() {
		GridData gridData9 = new GridData();
		gridData9.horizontalAlignment = GridData.FILL;
		gridData9.verticalAlignment = GridData.CENTER;
		comboEmailType = new Combo(compositeEmailDetails, SWT.NONE);
		comboEmailType.setLayoutData(gridData9);
	}



}  //  @jve:decl-index=0:visual-constraint="10,10"
